var url;

function newUser() {
	$('#dlg').dialog('open').dialog('center').dialog('setTitle', 'New User');
	$('#fm').form('clear');
	url = '/TicketManager/Admin/AdminUserController/pageUser';
}

function destroyUser() {
	var row = $('#dg').datagrid('getSelected');
	if (row) {
		$.messager.confirm('Confirm',
				'Are you sure you want to destroy this user?', function(r) {
					if (r) {
						$.post('/TicketManager/Admin/AdminUserController/deleteUser', {
							userId : row.userId
						}, function(result) {
							if (result.success) {
								$('#dg').datagrid('reload'); // reload the
																// user data
							} else {
								$.messager.show({ // show error message
									title : 'Error',
									msg : result.errorMsg
								});
							}
						}, 'json');
					}
				});
	}
}